package com.MedDroid.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.content.Intent;
import android.widget.Button;
import com.MedDroid.MainApp;
import com.MedDroid.R;
import com.MedDroid.task.LoadMainMenuTask;
import com.MedDroid.task.LogoutTask;


public class MainMenuActivity extends Activity
{
	public Button BtnNotificationPage;
	public Button BtnProfilePage;
	public Button BtnManageUsers;
	public Button BtnSchedulePage;
	public Button BtnLogout;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_menu);

        BtnNotificationPage = (Button) findViewById(R.id.btnSettingsPage);
        BtnNotificationPage.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View view) {
				//TODO insert code here elliot
                Intent intent = new Intent(MainMenuActivity.this, SettingsPageActivity.class);
                startActivity(intent);
            }
        });

        BtnProfilePage = (Button) findViewById(R.id.btnProfilePage);
		BtnProfilePage.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View view) {
				//TODO redirect to ListProfileActivity
                Intent intent = new Intent(MainMenuActivity.this, UserListActivity.class);
                startActivity(intent);
            }
        });

		BtnManageUsers = (Button) findViewById(R.id.btnManagementPage);
		BtnManageUsers.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View view)
			{
				//TODO insert code here elliot
				Intent intent = new Intent(MainMenuActivity.this, ManagementPageActivity.class);
				startActivity(intent);
			}
		});

		BtnSchedulePage = (Button) findViewById(R.id.btnSchedulePage);
		BtnSchedulePage.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View view)
			{
				//TODO insert code here
				Intent intent = new Intent(MainMenuActivity.this, SchedulePageActivity.class);
				startActivity(intent);
			}
		});

		BtnLogout = (Button) findViewById(R.id.btnLogout);
		BtnLogout.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View view)
			{
				//TODO insert code here
				new LogoutTask(((MainApp) getApplication()).getAuthentication()).execute();
				finish();
			}
		});

		//Hide Buttons based on user
		new LoadMainMenuTask(((MainApp) getApplication()).getAuthentication(),MainMenuActivity.this).execute();
    }
}
